CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/pages/software/r/[name].tsx
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Alert, Layout } from "antd";
7
8
import { SoftwareEnvNames } from "@cocalc/util/consts/software-envs";
9
import Footer from "components/landing/footer";
10
import Head from "components/landing/head";
11
import Header from "components/landing/header";
12
import Image from "components/landing/image";
13
import SoftwareLibraries from "components/landing/software-libraries";
14
import { Paragraph, Title } from "components/misc";
15
import A from "components/misc/A";
16
import { Customize, CustomizeType } from "lib/customize";
17
import { ExecutableDescription } from "lib/landing/render-envs";
18
import { withCustomizedAndSoftwareSpec } from "lib/landing/software-specs";
19
import {
20
ComputeComponents,
21
ComputeInventory,
22
SoftwareSpec,
23
} from "lib/landing/types";
24
import { STYLE_PAGE } from "..";
25
import screenshot from "/public/features/cocalc-r-jupyter.png";
26
27
interface Props {
28
name: SoftwareEnvNames;
29
customize: CustomizeType;
30
spec: SoftwareSpec["R"];
31
inventory: ComputeInventory["R"];
32
components: ComputeComponents["R"];
33
execInfo?: { [key: string]: string };
34
timestamp: string;
35
}
36
37
export default function R(props: Props) {
38
const { name, customize, spec, inventory, components, execInfo, timestamp } =
39
props;
40
41
function renderBox() {
42
return (
43
<Alert
44
style={{ margin: "15px 0" }}
45
message="Learn More"
46
description={
47
<span style={{ fontSize: "10pt" }}>
48
Learn more about{" "}
49
<strong>
50
<A href="/features/r-statistical-software">
51
R functionality in CoCalc
52
</A>
53
</strong>
54
.
55
</span>
56
}
57
type="info"
58
showIcon
59
/>
60
);
61
}
62
63
function renderIntro() {
64
return (
65
<>
66
<div style={{ width: "50%", float: "right", padding: "0 0 15px 15px" }}>
67
<Image src={screenshot} alt="Using R in a Jupyter notebook" />
68
</div>
69
<Paragraph>
70
This table lists all R pre-installed packages that are immediately
71
available in every CoCalc project running on the default "Ubuntu{" "}
72
{name}" image, along with their version numbers. If something is
73
missing, you can{" "}
74
<A href="https://doc.cocalc.com/howto/install-r-package.html">
75
install it yourself
76
</A>
77
, or request that we install them.
78
</Paragraph>
79
</>
80
);
81
}
82
83
return (
84
<Customize value={customize}>
85
<Head title="R Packages in CoCalc" />
86
<Layout>
87
<Header page="software" subPage="r" softwareEnv={name} />
88
<Layout.Content
89
style={{
90
backgroundColor: "white",
91
}}
92
>
93
<div style={STYLE_PAGE}>
94
<Title level={1} style={{ textAlign: "center" }}>
95
Installed R Statistical Software Packages (Ubuntu {name})
96
</Title>
97
{renderIntro()}
98
{renderBox()}
99
<Title level={2} style={{ clear: "both" }}>
100
Available Environments
101
</Title>
102
<ExecutableDescription spec={spec} execInfo={execInfo} />
103
<SoftwareLibraries
104
timestamp={timestamp}
105
spec={spec}
106
inventory={inventory}
107
components={components}
108
libWidthPct={60}
109
/>
110
</div>
111
<Footer />
112
</Layout.Content>
113
</Layout>
114
</Customize>
115
);
116
}
117
118
export async function getServerSideProps(context) {
119
return await withCustomizedAndSoftwareSpec(context, "R");
120
}
121
122